/*
 * @Description: 在ros中发布点云
 * @Author: Zhijian Qiao
 * @Date: 2020-02-05 02:27:30
 */

#ifndef avp_slam_PUBLISHER_IMAGE_PUBLISHER_HPP_
#define avp_slam_PUBLISHER_IMAGE_PUBLISHER_HPP_

#include <opencv2/core.hpp>
#include <opencv2/opencv.hpp>
#include <cv_bridge/cv_bridge.h>
#include <ros/ros.h>
#include "sensor_data/image_data.hpp"
#include<ros/ros.h>
#include<cv_bridge/cv_bridge.h>
#include<sensor_msgs/image_encodings.h>
#include<image_transport/image_transport.h>

#include<opencv2/opencv.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>

namespace avp_slam {
    class ImagePublisher {
    public:
        ImagePublisher(ros::NodeHandle &nh,
                       std::string topic_name,
                       size_t buff_size);

        ImagePublisher() = default;

        void Publish(ImageData::IMAGE &cloud_ptr_input, double time);

        void Publish(ImageData::IMAGE &cloud_ptr_input);

        bool HasSubscribers();

    private:
        void PublishData(ImageData::IMAGE &cloud_ptr_input, ros::Time time);

    private:
        ros::NodeHandle nh_;
        std::shared_ptr<image_transport::ImageTransport> it;
        image_transport::Publisher publisher_;
        sensor_msgs::ImagePtr msg;
    };
}
#endif